package com.qfmy.webapp.service.impl.user;

import com.qfmy.model.entity.userInfo.SignInReward;
import com.qfmy.model.vo.user.SignInRewardVo;
import com.qfmy.webapp.mapper.user.SignInRewardMapper;
import com.qfmy.webapp.service.user.SignInRewardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 清风明月
 * @Package com.qfmy.webapp.service.impl.user
 * @date 2025/11/26
 * @description 签到奖励表
 */
@Service
@SuppressWarnings("all")
public class SignInRewardServiceImpl implements SignInRewardService {

    /**
     * 注入mapper
     */
    @Autowired
    private SignInRewardMapper signInRewardMapper;

    /**
     * 获取所有签到奖励
     * @return
     */
    @Override
    public List<SignInRewardVo> getAllSignInReward() {
        List<SignInReward> signInRewardList = signInRewardMapper.getAllSignInReward();
        //转换为VO
        return signInRewardList.stream().map(signInReward -> {
            //创建 VO
            SignInRewardVo signInRewardVo = new SignInRewardVo();
            signInRewardVo.setDay(signInReward.getDay());
            signInRewardVo.setRewardCoin(signInReward.getRewardCoin());
            return signInRewardVo;
        }).collect(Collectors.toList());

    }
}
